<?php if ($this->_var['user_info']): ?>
<div style="padding: 10px">
<div><?php echo $this->_var['lang']['hello']; ?>，<?php echo $this->_var['user_info']['username']; ?>, <?php echo $this->_var['lang']['welcome_return']; ?>！</div>
<div><?php echo $this->_var['lang']['now_account']; ?> <?php echo $this->_var['user_info']['user_money']; ?> <?php echo $this->_var['lang']['balance']; ?>，<?php echo $this->_var['user_info']['user_points']; ?><?php echo $this->_var['lang']['along_with']; ?> <?php echo $this->_var['user_info']['user_bonus']; ?> <?php echo $this->_var['lang']['preferential']; ?></div>
<div align="right"><a href="user.php"><?php echo $this->_var['lang']['edit_user_info']; ?></a> | <a href="user.php?act=logout"><?php echo $this->_var['lang']['logout']; ?></a></div>
</div>

<?php else: ?>
<form id="ECS_LOGINFORM" name="ECS_LOGINFORM" method="post" action="javascript:signIn()">
  <table width="100%" border="0">
    <tr>
      <td nowrap><?php echo $this->_var['lang']['member_name']; ?></td>
      <td><input name="username" style="width:60px;" type="text" class="textbox-light" size="8" tabindex="1" value="<?php echo htmlspecialchars($this->_var['ecs_username']); ?>"/></td>
      <td rowspan="2"><input type="image" name="imageField2" src="themes/default_old/images/btn_login.gif" tabindex="4" /></td>
    </tr>
    <tr>
      <td nowrap><?php echo $this->_var['lang']['password']; ?></td>
      <td><input name="password" style="width:60px;" class="textbox-light" type="password" size="10" tabindex="2" /></td>
    </tr>
    <?php if ($this->_var['enabled_captcha']): ?>
    <tr>
      <td nowrap><?php echo $this->_var['lang']['comment_captcha']; ?></td>
      <td colspan="2"><input type="text" size="5" name="captcha" class="textbox-light" tabindex="3" /></td>
    </tr>
    <tr>
      <td nowrap>&nbsp;</td>
      <td colspan="2"><img src="captcha.php?is_login=1&<?php echo $this->_var['rand']; ?>" alt="captcha" style="vertical-align: middle;cursor: pointer;" onClick="this.src='captcha.php?is_login=1&'+Math.random()" /></td>
    </tr>
   <?php endif; ?>
    <tr>
      <td colspan="3"><ul>
          <li style="border-bottom: 1px dashed #CECECE;"><a href="user.php?act=register"><?php echo $this->_var['lang']['sign_up']; ?></a></li>
          <li><a href="user.php?act=get_password"><?php echo $this->_var['lang']['forgot_password']; ?></a></li>
        </ul></td>
    </tr>
  </table>
</form>

<script type="text/javascript">
/**
 * 会员登录
 */
function signIn()
{
  var frm = document.forms['ECS_LOGINFORM'];

  if (frm)
  {
    var username = frm.elements['username'].value;
    var password = frm.elements['password'].value;
    var captcha = '';
    if (frm.elements['captcha'])
    {
      captcha = frm.elements['captcha'].value;
    }

    if (username.length == 0 || password.length == 0)
    {

       alert("<?php echo $this->_var['lang']['empty_username_password']; ?>");

        return;
    }
    else
    {
       Ajax.call('user.php?act=signin', 'username=' + username + '&password=' + encodeURIComponent(password) + '&captcha=' + captcha, signinResponse, "POST", "TEXT");
    }
  }
  else
  {
    alert('Template error!');
  }
}

function signinResponse(result)
{
  var userName = document.forms['ECS_LOGINFORM'].elements['username'].value;
  var mzone = document.getElementById("ECS_MEMBERZONE");
  var res   = result.parseJSON();

  if (res.error > 0)
  {
    // 登录失败
    alert(res.content);
    if(res.html)
    {
      mzone.innerHTML = res.html;
      document.forms['ECS_LOGINFORM'].elements['username'].value = userName;
    }
  }
  else
  {
    if (mzone)
    {
      mzone.innerHTML = res.content;
	    evalscript(res.ucdata);
      //alert(res.ucdata);
    }
    else
    {
      alert("Template Error!");
    }
  }
}
</script>

<?php endif; ?>